package com.fzk.exception;

/**
 * 自定义异常，新增错误码
 *
 * @author fzk
 * @datetime 2023-03-19 16:30
 */
public class MyException extends Exception {
    private int code;

    public MyException(int code, String message) {
        super(message);
        this.code = code;
    }

    public MyException(int code, String message, Throwable cause) {
        super(message, cause);
        this.code = code;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    @Override
    public String toString() {
        return "MyException{" +
                "code=" + code +
                ", e=" + super.toString() +
                '}';
    }
}
